package com.guigu.controller;

import com.github.pagehelper.PageInfo;
import com.guigu.DeskOrderService;

import com.guigu.vo.*;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("DeskOrder")
public class DeskOrderController {
    @Autowired
    private DeskOrderService deskOrderService;
    @RequestMapping("selectAll/{pageNo}/{pageSize}")
    public Pojo<DeskOrderList> selectAll(@PathVariable int pageNo, @PathVariable int pageSize, @RequestBody DeskOrderVo vo) {
        //三表查询，订单表，用户表（用户名称），商户表（地址），
        PageInfo<DeskOrderList> orderPageInfo = deskOrderService.selectAll1(vo, pageNo, pageSize);
        Pojo<DeskOrderList> pojo = new Pojo<>();
        pojo.setRows(orderPageInfo.getList());
        pojo.setTotal(orderPageInfo.getTotal());
        return pojo;
    }
    @PostMapping("One/{ParentId}")
    public List<OrderDetailsList> One(@PathVariable int ParentId) {
        return  deskOrderService.selectParentId(ParentId);
    }
}
